package com.fitz.enums;

/**
 * @author fitz
 * Created  on 2020/6/8
 */
public enum SerializerEnum {
    /**
     * JSON
     */
    JSON((byte) 1,"JSON"),
    /**
     * HESSIAN2
     */
    HESSIAN2((byte) 2,"HESSIAN"),

    /**
     * KRYO
     */
    KRYO((byte) 3,"KRYO"),
    ;

    private byte code;

    private String type;

    SerializerEnum(byte code, String type) {
        this.code = code;
        this.type = type;
    }

    public byte getCode() {
        return code;
    }

    public String getType() {
        return type;
    }

    public static SerializerEnum find(String type){
        for(SerializerEnum serializer : SerializerEnum.values()){
            if (serializer.getType().equals(type)) {
                return serializer;
            }
        }
        return null;
    }
}
